{% extends "./default.html" %}
{% block content %}
{% import "./public/adsPannel.html" as adsPannel %}


<div class="blank"></div>
<article>
    <div class="leftbox">
        <div class="infos">
            <div class="newsview">
                <h2 class="intitle">您现在的位置是：<a href="/">网站首页</a>&nbsp;&gt;&nbsp;<a
                        href="/">{{(post.categories[post.categories.length-1]).name}}</a></h2>
                <h3 class="news_title">{{post.title}}</h3>
                <div class="news_author"><span class="au01">{{post.uAuthor.userName}}</span><span
                        class="au02">{{post.date}}</span><span class="au03">共<b>{{post.clickNum}}</b>人围观</span></div>
                <div class="tags">
                    {% for tag in post.tags %}
                    <a href="/" target="_blank">{{tag.name}}</a>&nbsp;
                    {% endfor %}
                </div>
                <div class="news_about">
                    <strong>简介</strong>{{post.discription}}
                </div>
                <div class="news_infos">
                    {{post.comments | safe}}
                </div>
            </div>
            <div class="share">
                <p class="diggit" style="float: none;margin: 0 auto;"><a href="JavaScript:devIng('{{post._id}}');">
                        很赞哦！ </a>(<b id="diggnum"> {{post.likeNum}}
                    </b>)</p>
            </div>
            <!--share end-->

        </div>
        <div class="nextinfo">
            {% near_post "id"=post._id %}
            {% if near_post %}
            {% if near_post.preContent.title %}
            <p>上一篇：<a href="{{near_post.preContent.url}}">{{near_post.preContent.title}}</a></p>
            {% endif %}
            {% if near_post.nextContent.title %}
            <p>下一篇：<a href="{{near_post.nextContent.url}}">{{near_post.nextContent.title}}</a></p>
            {% endif %}
            {% endif %}
        </div>
        {% include "./public/randomList.html" %}

        <div class="news_pl">
            <h2>文章评论</h2>
            <ul>
            </ul>
        </div>
    </div>
    <div class="rightbox">
        {% include './public/sidebar.html' %}
    </div>
</article>
<script>
    function devIng(id) {
        getAjaxData('/api/user/askContentThumbsUp?contentId=' + id, (data) => {
            if (data.status == 200) {
                var newNum = Number($('#diggnum').text()) + 1;
                $('#diggnum').text(newNum);
                layer.msg(data.message, {
                    icon: 1,
                    time: 800
                });
            }
        })
    }
</script>
{% endblock %}